<template>
  <div>
    <div class="g-cnt">
      <t-tag-filter
        ref="filter"
        :filterFields="srcData.list"
				visibleHelpPopover
        @change="console.log('======== change')"
        tabIndex="1"
      ></t-tag-filter>

      <div @click="clickDiv">点击事件</div>
    </div>
  </div>
</template>

<script setup>
import tagFilter from 't/bussiness/tag-filter';
import { computed, nextTick, onMounted, reactive, ref } from 'vue';

const srcData = reactive({
  list: [],
});
const list = [
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=1',
    tagFilterValue: '1',
    tagFilterShowName: '处理中',
    tagFilterShowTip: '处理中处理中处理中处理中处理中处理中',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
  {
    ID: '0ab3921b-313a-493f-8b04-9cca3afe3f18',
    tableAlias: 'DO_Sta',
    tableCode: 'DO_Sta',
    tableName: '数据对象113959',
    fieldCode: 'OperStartTime',
    fieldName: '开始运营时间',
    fieldAlias: 'OperStartTime',
    dataType: 'DateTime',
    tagFilterCode: 'DO_Sta.OperStartTime=2',
    tagFilterValue: '2',
    tagFilterShowName: '已完成',
    tagFilterShowTip: '已完成已完成已完成已完成已完成已完成',
  },
];

const filter = ref();
function clickDiv() {
  console.log(
		'---------- getTagFilter',
    filter.value.getTagFilters(),
    filter.value.getTagFilters({
      ElementType: 'Group',
      Filters: [
        {
          ElementType: 'Filter',
          Code: 'DO_Sta.OperStartTime',
          Condition: '=',
          ValueType: 0,
          Name: '开始运营时间',
          Value: '1',
        },
        {
          ElementType: 'Relation',
          Relation: 'and',
        },
        {
          ElementType: 'Filter',
          Code: 'DO_Sta.OperStartTime',
          Condition: '=',
          ValueType: 0,
          Name: '开始运营时间',
          Value: '2',
        },
      ],
    }),
  );
}

onMounted(async () => {
  await nextTick();
  srcData.list = list;
});
</script>

<style lang="scss" scoped>
.g-cnt {
  padding: 10px;
}
</style>
